package com.cat.combination;

import java.util.stream.IntStream;

/**
 * @author cat
 * @version 2025/5/23 17:59
 * @description 菜单项(叶子节点)
 * @since JDK17
 */

public class MenuItem extends MenuComponent {

    @Override
    public void add(MenuComponent menuComponent) {
        super.add(menuComponent);
    }

    public MenuItem(String name, int level) {
        super(name, level);
    }

    @Override
    public void print() {
        IntStream.range(1, level).forEach(o -> System.out.print("--"));
        System.out.println(name);
    }
}
